import {messages} from "share/common";
import React from 'react';
import {Tag} from 'antd';

export default {
  getGeneralViewColumns: function () {
    const columns = [
      {
        title: messages('supplier-1.key2')/*创建日期*/,
        dataIndex: 'submittedDate',
        key: 'submittedDate',
        sorter: true
      },
      {
        title: messages('common.applicant')/*申请人*/,
        dataIndex: 'applicant',
        key: 'applicant',
      },
      {
        title: messages('common.document.name')/*单据名称*/,
        dataIndex: 'formName',
        key: 'formName',
      },
      {
        title: messages('supplier-1.key3')/*事由*/,
        dataIndex: 'title',
        key: 'title',
      },
      {
        title: messages('common.document.code')/*单号*/,
        dataIndex: 'businessCode',
        key: 'businessCode',
      },
      {
        title: messages('common.currency')/*币种*/,
        dataIndex: 'currencyCode',
        key: 'currencyCode',
        sorter: true
      },
      {
        title: messages('common.amount')/*金额*/,
        dataIndex: 'totalAmount',
        key: 'totalAmount',
      },
      {
        title: messages('supplier-1.key4')/*本币金额*/,
        dataIndex: 'baseCurrencyAmount',
        key: 'baseCurrencyAmount',
      },
      {
        title: messages('common.column.status')/*状态*/,
        dataIndex: 'statusName',
        key: 'statusName',
        render:(value, record) => {
          switch (record.status){
            case 1001: return <Tag color='#55B1F2'>{value}</Tag>;
            case 1002: return <Tag color='#4DC690'>{value}</Tag>;
            case 1003: return <Tag color='#FF6680'>{value}</Tag>;
            default: return '';
          }
        }
      },
    ];
    return columns;
  }
}
